//
//  SizeToFitTool.m
//  Leisure
//
//  Created by xalo on 16/7/2.
//  Copyright © 2016年 蓝鸥科技有限公司西安分公司. All rights reserved.
//

#import "SizeToFitTool.h"

@implementation SizeToFitTool

+(CGFloat)fixHeightWithImageView:(UIImageView *)selectedImageView imageWidth:(CGFloat)imageWidth{
    
    UIImage *image = selectedImageView.image;
    CGFloat width = image.size.width;
    CGFloat height = image.size.height;
    
    return imageWidth * height /width;
    
    
}
+(CGFloat)fixHeightToLabelText:(NSString *)string font:(UIFont *)textFont  label:(CGFloat)labelWidth {
    
    NSDictionary *dic = @{NSFontAttributeName :textFont};
    CGRect rect = [string boundingRectWithSize:CGSizeMake(labelWidth, 1000000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    
    
    
    
    return rect.size.height;
    
    
}


@end
